// vuex 状态管理

import { createStore } from 'vuex';
import mutations from './mutations';
import storage from '../utils/storage';

const state = {
  userInfo: storage.getItem('userInfo') || {}, // 用户信息
  noticeCount: 0, //通知数
  activeTab: storage.getSessionItem('activeTab') || {
    title: '首页',
    name: '/welcome',
  },
  openedTabs: storage.getSessionItem('openedTabs') || [
    { title: '首页', name: '/welcome' },
  ],
  menuList: storage.getItem('menulist') || [], // 菜单列表
  actionList: storage.getItem('actionList') || [], // 按钮列表
};

export default createStore({
  state,
  mutations,
});
